package com.kgcx.coupon.service;

import com.kgcx.coupon.domain.CouponDetail;
import com.kgcx.coupon.mapper.CouponDetailMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 何凯
 * @version 0.1
 * @description
 * @time 2017/12/12 17:52
 * @since 0.1
 */
@Service
public class CouponDetailService {
    @Autowired
    private CouponDetailMapper couponDetailMapper;

    /**
     * 单条新增互斥方案
     * @param detail
     */
    public void saveCouponDetail(CouponDetail detail){
        couponDetailMapper.insert(detail);
    }
    /**
     * 批量新增优惠券明细
     * @param list
     */
    public void insertByBatch(List<CouponDetail> list){
        couponDetailMapper.insertByBatch(list);
    }

    /**
     * 修改优惠券明细
     * @param record
     */
    public void updateByPrimaryKeySelective(CouponDetail record){
        couponDetailMapper.updateByPrimaryKeySelective(record);
    }

    /**
     * 删除优惠券明细
     * @param kid
     */
    public void deleteByPrimaryKey(Integer kid){
        couponDetailMapper.deleteByPrimaryKey(kid);
    }
    /**
     * 删除优惠券明细
     * @param planId
     */
    public void deleteByPlanId(Integer planId){
        couponDetailMapper.deleteByPlanId(planId);
    }

    /**
     * 获取新人策略 type为2
     * @return
     */
    public List<CouponDetail> selectNewStrategy() {
    		return couponDetailMapper.selectNewStrategy();
    }

    /**
     * 获取方案优惠券 type为1
     * @param planIds
     * @return
     */
    public List<CouponDetail> selectByPlanIds(List<Long> planIds){
         return  couponDetailMapper.selectByPlanIds(planIds);
    }

}
